package com.yzkj.cpjxc.business.constants;

import com.yzkj.cpjxc.business.framework.utils.property.PropertyFactory;
import org.apache.commons.lang3.StringUtils;

import java.util.LinkedHashMap;
import java.util.Map;


/**
 * 方法调用时间常量类
 */
public class SysMethodCallTimeConstants {
	
	public static Map<String, String> getGradeMap() {
		String level = PropertyFactory.getInstance().getPropertyByKey("all.properties", "method_time_level");
		String[] levels = StringUtils.split(level, ";");
		
		Map<String, String> gradelMap = new LinkedHashMap<String, String>();
		if (levels != null && levels.length > 0) {
			for (int i=0; i < levels.length; i++) {
				if (i == (levels.length -1)) {
					if (StringUtils.contains(levels[i], "#")) {
						gradelMap.put((i + 1) + "", StringUtils.replace(levels[i], "#", "-").trim() + "毫秒");
					} else {
						gradelMap.put((i + 1) + "", StringUtils.replace(levels[i], "#", "-").trim() + "毫秒以上");
					}
				} else {
					gradelMap.put((i + 1) + "", StringUtils.replace(levels[i], "#", "-").trim() + "毫秒");
				}
			}
		}
		
		return gradelMap;
	}

}

